package com.zero.manage.web.components.query;

import com.querydsl.core.types.Order;
import com.querydsl.core.types.Predicate;
import com.zero.manage.web.components.base.BaseQuery;
import com.zero.manage.web.components.entity.QSysDictDetailsEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import java.util.LinkedHashMap;

/**
 * @author zero
 */
@Getter
@Setter
@ApiModel("系统字典详情-查询条件")
public class SysDictDetailsQuery extends BaseQuery {

    @ApiModelProperty("系统字典编号")
    @NotBlank(message = "系统字典编号必填")
    private String dictCode;

    @Override
    public Predicate predicate() {
        QSysDictDetailsEntity qSysDictDetailsEntity = QSysDictDetailsEntity.sysDictDetailsEntity;
        return qSysDictDetailsEntity.dictCode.eq(dictCode);
    }

    /**
     * 后端固定排序
     *
     * @return
     */
    @Override
    protected LinkedHashMap<String, String> initSort() {
        LinkedHashMap<String, String> map = new LinkedHashMap<>(1);
        map.put("sort", Order.ASC.name());
        return map;
    }
}


